/*年轻人，只管向前看，不要管自暴自弃者的话*/
package com.composetest.page.main.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import com.composetest.page.main.MainRoute
import com.composetest.ui.navigation.myComposable

const val MAIN_ROUTE = "main"

/**
 * 跳转到
 */
fun NavController.navigationToMain(): Unit {
    navigate(MAIN_ROUTE) {
        launchSingleTop = true
        // 关闭首页之前页面
        popUpTo(MAIN_ROUTE)
    }
}

/**
 * 配置导航
 */
fun NavGraphBuilder.mainScreen(toProductDetail: (String) -> Unit): Unit {
    myComposable(MAIN_ROUTE) {
        MainRoute(toProductDetail = toProductDetail)
    }
}
